<template>
  <div @mouseenter="dealShow(true)" @mouseleave="dealShow(false)">
  <div class="checkbox" >
    <label>
      <input type="checkbox" v-model="todo.finish"> {{todo.title}}
    </label>
    <button type="button" class="btn btn-link" v-show="isShowBtn" @click="delHandler(todo.id)">删除</button>
  </div>
  </div>
</template>

<script>
export default {
  props: {
    todo: Object,
    delTodo: Function
  },
  data() {
    return {
      isShowBtn: false
    }
  },
  setup () {
    return {}
  },
  methods: {
    dealShow(isShow) {
      this.isShowBtn = isShow
    },
    delHandler(id) {
      this.delTodo(id);
    }
  },
}
</script>

<style lang="scss" scoped>
button {
  float: right;
}
</style>